<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
    <head>
        <meta charset="UTF-8">
        <title>表单</title>
    </head>
    <script th:src="@{/webjars/jquery/3.4.1/jquery.min.js}"></script>
    <script type="text/javascript" th:src="@{/static/js/index.js}"></script>
    <body hidden="true">
        <div align="center">
            <form action="#" th:action="@{/listUser}" method="post">
                <label for="name">全表查询：</label>
                <input id="name" name="name" th:value="${name}">
                <button id="search-btn" name="search-btn">搜索</button>
            </form>
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <a th:href="@{/add}">添加联系人</a>
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <a th:href="@{/listUser}">刷新全部数据</a>
            <table width="100%" border="1">

                <tr align="center">
                    <td width="5%">id号</td>
                    <td width="20%">查询人身份证</td>
                    <td width="15%">查询人的名称</td>
                    <td width="15%">查询人的日期</td>
                    <td width="10%">查询渠道</td>
                    <td width="10%">是否注册</td>
                    <td colspan="2" width="10%">操作</td>
                </tr>
                <tr align="center" th:each="list: ${pages.list}">
                    <td th:text="${list.id}"></td>
                    <td><a th:href="@{/getUser(id=${list.id})}">[[${list.carId}]]</a></td>
                    <td th:text="${list.userName}"></td>
                    <td th:text="${list.nickname}"></td>
                    <td th:text="${list.phone}"></td>
                    <td th:text="${list.register}==1?'是':'否'"></td>
                    <td><a th:href="@{/findUser(id=${list.id})}">编辑</a></td>
                    <td><a th:href="@{/deleteUser(id=${list.id})}">删除</a></td>
                </tr>
            </table>
        </div>
        <div align="center">
            <a th:unless="${pages.isFirstPage}"
               th:href="@{/listUser(name=${name})}">首 页</a>
            <a th:unless="${pages.isFirstPage}"
               th:href="@{/listUser(start=${pages.hasPreviousPage}?${pages.prePage}:1, name=${name})}">上一页</a>
            <a th:unless="${pages.isLastPage}"
               th:href="@{/listUser(start=${pages.hasNextPage}?${pages.nextPage}:${pages.pages}, name=${name})}">下一页</a>
            <a th:unless="${pages.isLastPage}"
               th:href="@{/listUser(start=${pages.pages}, name=${name})}">末 页</a>
        </div>

        <script type="text/javascript">

        </script>
    </body>
</html>